Catch xen.xend.XendProtocol.XendError as well as xen.xend.XendError.XendError.
authoremellor@ewan <emellor@ewan>
Tue, 4 Oct 2005 10:43:38 +0000 (11:43 +0100)
committeremellor@ewan <emellor@ewan>
Tue, 4 Oct 2005 10:43:38 +0000 (11:43 +0100)
This horror needs cleaning up -- this is just a stopgap.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/main.py

index 10b70f14701b7347381ab6ba6a304cefa2fc6dbf..b7fa555eb232d730618067cafb4449fcc3125d30 100644 (file)
@@ -32,6 +32,7 @@ import warnings
 warnings.filterwarnings('ignore', category=FutureWarning)
 
 import xen.xend.XendError
+import xen.xend.XendProtocol
 
 from xen.xend import PrettyPrint
 from xen.xend import sxp
@@ -710,6 +711,14 @@ def main(argv=sys.argv):
                 print
                 print "Please report to xen-devel@lists.xensource.com"
                 raise
+        except xen.xend.XendProtocol.XendError, ex:
+            if len(args) > 0:
+                handle_xend_error(argv[1], args[0], ex)
+            else:
+                print "Unexpected error:", sys.exc_info()[0]
+                print
+                print "Please report to xen-devel@lists.xensource.com"
+                raise
         except SystemExit:
             sys.exit(1)
         except: